package org.bbelovic.devel.exercises.number.primes;

import java.util.ArrayList;
import java.util.List;

public class PrimePairsFilter implements Filter {


    public List<Integer> filter(final List<Integer> input) {
        final List<Integer> result = new ArrayList<Integer>();
        final int size = input.size();
        for (int i = 0; i < size - 1; i++) {
            final int first = input.get(i);
            final int second = input.get(i+1);
            if (second - first == 2) {
                result.add(first);
                result.add(second);
            }
        }
        return result;
    }

}
